﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using VietThuongLMS.Areas.Admin.Models;

///Tin tuc Converter
///Author: NHDuc
///Created date: 24/11/2013
namespace VietThuongLMS.Utils
{
    public class TinTucConverter
    {
        public TinTuc ModelToTinTuc(TinTucModel model)
        {
            TinTuc tt = new TinTuc();
            tt.TieuDe = model.TieuDe;
            tt.NoiDung = model.NoiDung;
            tt.UrlAvatar = model.UrlAvatar.FileName;
            return tt;
        }

        public TinTucModel TinTucToModel(TinTuc tt)
        {
            TinTucModel model = new TinTucModel();
            model.TieuDe = tt.TieuDe;
            model.NoiDung = tt.NoiDung;
            model.strUrlAvatar = tt.UrlAvatar;
            model.Tag = tt.Tag;
            return model;
        }
    }

    public class ChiNhanhConverter
    {
        public ChiNhanh ModelToChiNhanh(ChiNhanhModel model)
        {
            ChiNhanh tt = new ChiNhanh();
            tt.TenChiNhanh = model.TenChiNhanh;
            tt.DiaChi = model.DiaChi;
            tt.MoTa = model.MoTa;
            tt.UrlAvatar = model.UrlAvatar.FileName;
            return tt;
        }

        public ChiNhanhModel ChiNhanhToModel(ChiNhanh tt)
        {
            ChiNhanhModel model = new ChiNhanhModel();
            model.TenChiNhanh = tt.TenChiNhanh;
            model.DiaChi = tt.DiaChi;
            model.MoTa = tt.MoTa;
            model.strUrlAvatar = tt.UrlAvatar;
            model.strUrlAvatar2 = tt.UrlAvatar2;
            model.strUrlAvatar3 = tt.UrlAvatar3;
            model.strUrlAvatar4 = tt.UrlAvatar4;
            model.strUrlAvatar5 = tt.UrlAvatar5;
            return model;
        }
    }

    public class HinhAnhConverter
    {
        public HinhAnh ModelToHinhAnh(HinhAnhModel model)
        {
            HinhAnh tt = new HinhAnh();
            tt.TenAnh = model.TenAnh;
            //tt.Tag = model.Tag;
            //tt.Type = model.Type;
            tt.Url = model.Url.FileName;
            return tt;
        }

        public HinhAnhModel HinhAnhToModel(HinhAnh tt)
        {
            HinhAnhModel model = new HinhAnhModel();
            model.TenAnh = tt.TenAnh;
            //model.Tag = tt.Tag;
            //model.Type = tt.Type.Value;
            model.strUrl = tt.Url;
            model.UrlVideo = tt.UrlVideo;
            return model;
        }
    }

    public class AlbumConverter
    {
        public Album ModelToAlbum(AlbumModel model)
        {
            Album tt = new Album();
            tt.TenAlbum = model.TenAlbum;
            tt.Type = model.Type;
            tt.Tag = model.Tag;
            tt.Url = model.Url.FileName;
            return tt;
        }
        public AlbumModel AlbumToModel(Album tt)
        {
            AlbumModel model = new AlbumModel();
            model.TenAlbum = tt.TenAlbum;
            model.Type = tt.Type.Value;
            model.Tag = tt.Tag;
            model.strUrl = tt.Url;
            return model;
        }
    }

    public class LoaiTinTucConverter
    {
        public LoaiTinTuc ModelToLoaiTinTuc(LoaiTinTucModel model)
        {
            LoaiTinTuc tt = new LoaiTinTuc();
            tt.TenLoaiTinTuc = model.TenLoaiTinTuc;
            return tt;
        }
        public LoaiTinTucModel LoaiTinTucToModel(LoaiTinTuc tt)
        {
            LoaiTinTucModel model = new LoaiTinTucModel();
            model.TenLoaiTinTuc = tt.TenLoaiTinTuc;
            return model;
        }
    }
}